<?php

/*
Block Name: Blog Stats
Version: 1.0
Block URI: http://www.freshpursuits.com/canvas
Author: Yas
Description: A quick summary of the number of posts and comments on your blog.
Group: Wordpress
*/

global $wpdb;
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
if (0 < $numposts) $numposts = number_format($numposts); 

$numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
if (0 < $numcomms) $numcomms = number_format($numcomms);

$numcats = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
if (0 < $numcats) $numcats = number_format($numcats);
?>
<h5>Blog Stats</h5>
<div class="block">
	<p><?php printf(__('There are currently <strong>%1$s posts</strong> and <strong>%2$s comments</strong>, contained within <strong>%3$s categories</strong>.'), $numposts, $numcomms, $numcats); ?></p>
</div>